<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
@html_name: 19class继承
@description: The past cannot be redeemed, the future can be changed.
@author: Jason Black
@create: 2023/6/26 09:54:05
-->
<script>
  // extends 继承父类，   super(param) 调用父类的构造器
  // 也有方法重写
  class People{
    constructor(name,age){
        this.name = name
        this.age = age
    }
    methodPeople(){
        console.log("this method is methodPeople...")
    }
  }
  class Teacher extends People{
      constructor(name,age,salary,sex){
          super(name,age)
          this.salary  = salary
          this.sex = sex
      }
      methodTeacher(){
          console.log("this method is methodTeacher...")
      }
  }
  const JACKSON = new Teacher("Jason",21,20000,"male")
  JACKSON.methodTeacher()
  JACKSON.methodPeople()
  console.log(JACKSON)
</script>
</body>
</html>